#include <iostream>
#include <unistd.h>
using namespace std;
int main()
{
    pid_t id = fork();
    if(id == 0)
    {
        //child
        while(1)
        {
            cout << "i am child, mypid: " << getpid() << "myppid: " << getppid() << endl;
            sleep(1);
            int* p = nullptr;
            *p = 100;
        }
    }
    else
    {
        //parent
        while(1)
        {
            cout << "i am parent, mypid: " << getpid() << "myppid: " << getpid() << endl;
            sleep(1);
        }

    }
    return 0;
}
